local skel = fk.CreateSkill{
  name = "lb__youren",
}

Fk:loadTranslationTable{
  ["lb__youren"] = "游刃",
  [":lb__youren"] = "当你使用牌造成伤害后，若目标唯一且其装备区内没有牌，你可以获得造成伤害的牌，若你本回合对其使用过同名牌，本回合此技能失效。",

  ["$lb__youren1"] = "马上就让你知道我的厉害。",
  ["$lb__youren2"] = "这便是云骑军的实力！",
}

skel:addEffect(fk.Damage, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    local room = player.room
    local start_event = room.logic:getCurrentEvent():findParent(GameEvent.Turn, true)
    if target == player and player:hasSkill(skel.name) and #data.to:getCardIds("e") == 0 and
    data.card and room:getCardArea(data.card) == Card.Processing and start_event then
      local e = room.logic:getEventsByRule(GameEvent.UseCard, 1, function(e)
          local use = e.data
          return use.card.id == data.card.id and #use.tos == 1 and 
          use.tos[1] == data.to
        end, start_event.id)
      if #e > 0 then
        event:setCostData(self,{id = e[1].id})
        if data.card:isRuleVirtual() then
          return #data.card.subcards > 0
        end
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local card = data.card:isRuleVirtual() and data.card.subcards or data.card
    room:obtainCard(player, card, true, fk.ReasonJustMove)
    if (#room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
      local use = e.data
      return e.id ~= event:getCostData(self).id and use.card.trueName == data.card.trueName and use.from == player
      and table.contains(use.tos,data.to)
    end,  Player.HistoryTurn) > 0) then
      room:invalidateSkill(player, skel.name, "-turn")
    end
  end,
})

return skel